﻿<style type="text/css">
</style>
<div class="mv-edit validate-area" style="margin-top:10px;">
    <div class="cont-top">
        <span>所属银行</span>
        <select id="bankid" class="validate-elem" validate="true" validate-message="请选择所属银行" :value="bag.basis.info.bankid">
            <option value="">请选择</option>
            <option :value="bank.id" v-for="bank in bag.banks">
                {{ bank.name }}
            </option>
        </select>
    </div>
    <div class="cont-top">
        <span>开户行</span>
        <input id="bankname" type="text" :value="bag.basis.info.bankname" class="validate-elem" validate="true" validate-message="请输入开户地址" placeholder="请输入开户地址">
    </div>
    <div class="cont-top">
        <span>开户人</span>
        <input type="text" :value="bag.basis.info.idname" readonly="readonly">
    </div>
    <div class="cont-top">
        <span>卡号</span>
        <input id="bankno" type="text" :value="bag.basis.info.bankno" class="validate-elem" validate="true" validate-message="请输入卡号" placeholder="请输入卡号">
    </div>
    <div class="cont-top" style="position: relative;" v-if="bag.basis.info.issetmoblie == false">
        <span>手机验证码</span>
        <input id="smscode" type="text" class="validate-elem" placeholder="请输入验证码" validate="true" validate-message="请输入验证码">
        <input type="text" class="lg-yzm" value="获取验证码" readonly="readonly" v-on:click="send_sms($event)">
    </div>
    <div class="cont-top" style="position: relative;" v-if="bag.basis.info.issetemail == false">
        <span>邮箱验证码</span>
        <input id="mailcode" type="text" class="validate-elem" placeholder="请输入验证码" validate="true" validate-message="请输入验证码">
        <input type="text" class="lg-yzm" value="获取验证码" readonly="readonly" v-on:click="send_mail($event)">
    </div>
    <div class="cont-top" v-if="bag.basis.info.issetoptcode == false">
        <span>谷歌验证</span>
        <input id="otpcode" type="password" class="validate-elem" validate="true" validate-message="请输入谷歌验证码" placeholder="请输入谷歌验证码">
    </div>
</div>
<div style="height:60px;"></div>
<script type="text/javascript">
    var pagedata = {
        request: {
            method: "VIEW_USER_SETTING_BANK"
        },
        screen: {
            header_ok_display: true,
            header_display: true,
            header_title_name: "银行卡",
            header_exit_name: "返回",
            header_ok_name: '保存',
            header_exit_click: function () {
                mview.view.load('/views/User/paymeet.html')
            },
            header_ok_click: function () {
                //调用验证表单程序
                mview.view.form.validate("validate-area", function (data) {
                    mview.socket.send({
                        data: {
                            method: "USEREDIT_BANK",
                            otpcode: data.otpcode || "",
                            bankid: data.bankid,
                            bankname: data.bankname,
                            bankno: data.bankno,
                            smscode: data.smscode || "",
                            mailcode: data.mailcode || ""
                        },
                        success: function (data) {
                            if (data.Code == 0) {
                                mview.control.tips("修改成功");
                                setTimeout(function () {
                                    mview.view.load("views/user/paymeet.html");
                                }, 1500);
                            }
                            else {
                                mview.control.tips(data.Message);
                            }
                        }
                    });
                });
            },
            header_display: true,
            footer_choose: "user"
        },
        data: {

        },
        methods: {
            send_sms: function (event) {
                var elm = event.target;
                mview.custom.sms_only_send(elm);
            },
            send_mail: function (event) {
                var elm = event.target;
                mview.custom.mail_only_send(elm);
            }
        }
    }
    mview.view.chlid.init(pagedata);
</script>